package fr.umlv.m2.uwp2011.persistence.user;

import java.io.Serializable;

import fr.umlv.m2.uwp2011.persistence.matiere.TroncCommun;

@SuppressWarnings("serial")
public class User_TroncCommun_PK implements Serializable {

	private TroncCommun troncCommun;
	
	private String user_id;
	
	public User_TroncCommun_PK() {
		
	}
	
	public User_TroncCommun_PK(TroncCommun troncCommun, String user_id) {
		this.troncCommun = troncCommun;
		this.user_id = user_id;
	}

	public void setTroncCommun(TroncCommun troncCommun) {
		this.troncCommun = troncCommun;
	}

	public TroncCommun getCursus() {
		return troncCommun;
	}

	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}

	public String getUser_id() {
		return user_id;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj == this) {
			return true;
		}
		if(!(obj instanceof User_TroncCommun_PK)) {
			return false;
		}
		User_TroncCommun_PK pk = (User_TroncCommun_PK)obj;
		return troncCommun.getId() == pk.troncCommun.getId() && user_id.equals(pk.user_id);
	}
	
	@Override
	public int hashCode() {
		return (user_id + troncCommun.getId()).hashCode();
	}
}
